<?php
     /**
      * CHILD FILE OF TOWN.PHP
      * */
     
    /** only way to here is from village **/ 
    if(isset($_SESSION['curr_location']) && $_SESSION['curr_location'] == 'village')
    {    
        hr('Outskirts of the Village');
        lwriteln('`2The murky forest stands before you -
            a giant maw of gloomy darkness, ever beckoning');
    
        $c = getCharacterRecord($_SESSION['id']);                           /* GET CHAR INFO                */


   
?>
    <p>
    <a href="?loc=o&opt=hunt"><?=lwriteln('`0(`5L`0)`2ook for enemies');?></a>
    <a href="?loc=o&opt=potion"><?=lwriteln('`0(`5D`0)`2rink a potion');?></a>
    <a href="town.php"><?=lwriteln('`0(`5R`0)`2eturn to town');?></a>
    </p>
    
    <p>
        <?php
         if(isset($_GET['opt']))
        {
            switch($_GET['opt'])
            {
                /*#######################################*/
                /*##### [ player drining a potion ]######*/
                /*#######################################*/
                case 'potion':
                    include 'usepotion.php';
                break;
                
                /*###################################################*/
                /*##### [ player looking for monsters to kill ] #####*/
                /*###################################################*/
                case 'hunt' :
                    /* check for instance or fight encounter*/
                    /* see if player has any instances remaining */
                    if($c['instance'] > 0)
                    {
                        /* roll against chance instance will happen (events_drop) */
                        $roll = mt_rand(1,100);
                        if($roll <= $s['game']['events_drop'])
                        {
                            header('location:events.php');
                            die();
                        }
                        else
                        {
                            header('location:encounter.php');
                            die();
                        }
                    }
                    else /* no instances left so it defaults to a fight enoucnter */
                    {
                        header('location:encounter.php');
                        de();
                    }
                break;
            }// switch options: drink or fight
        }// did palyer opt to drink or fight?
        ?>
    </p>
    
    <p>
        <?=lwriteln('`2HitPoints: `0(`$'.$c['hp'].'`2 of `$'.$c['hpMax'].'`0)');?>
        <?=lwriteln('`2  Fights: `0'.$c['pve'].'`2,  Gold: `$'.number_format($c['gold']).'`2, Potions: `$'.$c['potions'].'`2, Crystals: `5'.$c['gem']);?>
    </p>
<?php
    }
?>

